import Main from '../views/Main.vue';
import index from '../views/index.vue';
import commonRouters from '@/common/router';

export const appRouter = [
    {
        path: '/',
        name: 'index',
        meta:{},
        component: index
    },
    {
        path:'/emailAuth',
        name: 'emailAuth',
        meta: {
            title: 'emailAuth - 邮箱认证'
        },
        component: resolve => { require(['../views/home/emailAuth.vue'], resolve); }
    },
    {
        path: '/index',
        redirect:'/',  //路由重定向  当点击首页的链接时会进入到index/..路径 ，但此时路由指向为根目录且此时为组件由index转换为main组件，  当点击首页的连接时，会将内容呈现在main.vue的坑中
        name: 'main',
        component: Main,
        children: [
            { path: 'login', meta:{title: "登陆"}, name: 'login', component: resolve => { require(['../views/login.vue'], resolve); }},
            //通知公告，新闻资讯，政策法规，帮助中心，参照http://www.wantongsoft.cn:8081/common/info_list.aspx
            { path: 'article', meta:{title: '文章' }, name: 'main_article', component: resolve => { require(['../views/home/article.vue'], resolve); }, children:[
                { path: 'list/:p_type/:a_type', meta:{title: '文章列表', keepAlive: true }, name: 'article_list', component: resolve => { require(['../views/home/article_list.vue'], resolve); }},
                { path: 'detail/:p_type/:id', meta:{title: '文章详情'}, name: 'main_article_detail', component: resolve => { require(['../views/home/article_detail.vue'], resolve); }}
            ]},
            { path: 'latest_article', meta: { title: '最新消息' }, name: 'latest_article', component: resolve => { require(['../views/home/latest_Article.vue'], resolve); } },
            { path: 'find_article', meta:{title: '文章查找'}, name: 'find_article', component: resolve => { require(['../views/home/find_article.vue'], resolve); }},
            { path: 'register', meta:{title: '会员注册'}, name: 'register', component: resolve => { require(['../views/home/register.vue'], resolve); }},
            { path: 'pwdback', meta:{title: '密码找回'}, name: 'pwdback', component: resolve => { require(['../views/home/pwdback.vue'], resolve); }},
            { path: 'question', meta:{title: '问题反馈'}, name: 'question', component: resolve => { require(['../views/home/question.vue'], resolve); }},
            { path: 'help', meta:{title: '帮助中心'}, name: 'help', component: resolve => { require(['../views/home/help.vue'], resolve); }, children: [
                { path: 'detail/:id', meta:{title: '帮助中心'}, name: 'help_detail', component: resolve => { require(['../views/home/help_detail.vue'], resolve); }}
            ]},
            { path: 'about', meta:{title: '关于我们'}, name: 'about', component: resolve => { require(['../views/home/about.vue'], resolve); }},
            { path: 'find_demand', meta:{title: '找需求'}, name: 'find_demand', component: resolve => { require(['../views/home/find_demand.vue'], resolve); }},
            { path: 'find_service', meta:{title: '找服务'}, name: 'find_service', component: resolve => { require(['../views/home/find_service.vue'], resolve); }},
            { path: 'find_agen_com', meta:{title: '企业机构搜索'}, name: 'find_agen_com', component: resolve => { require(['../views/home/find_agen_com.vue'], resolve); }},
            { path: 'service_detail/:id', meta:{title: '服务详情'}, name: 'service_detail', component: resolve => { require(['../views/home/service_detail.vue'], resolve); }},
            { path: 'demand_detail/:id', meta:{title: '需求详情'}, name: 'demand_detail', component: resolve => { require(['../views/home/demand_detail.vue'], resolve); }},
            { path: 'personal_exhibition/:id', meta:{title: '个人展厅'}, name: 'personal_exhibition', component: resolve => { require(['../views/home/personal_exhibition.vue'], resolve); }},
            { path: 'specialservice_list', meta:{title: '风险补偿金'}, name: 'specialservice_list', component: resolve => { require(['../views/home/specialservice_list.vue'], resolve); }},
            { path: 'specialservice_detail/:id', meta:{title: '平台金融服务'}, name: 'specialservice_detail', component: resolve => { require(['../views/home/specialservice_detail.vue'], resolve); }},
            { path: 'searchall', meta:{title: '精确检索'}, name: 'searchall', component: resolve => { require(['../views/home/searchall.vue'], resolve); }}
        ]
    },
    { 
        path: '/module/:name', 
        redirect:'/',
        meta:{title: '平台模块'}, 
        name: 'module', 
        component: resolve => { require(['../views/home/module.vue'], resolve); }, 
        children: [
            { path: 'module_info', meta:{title: '平台模块信息'}, name: 'module_info', component: resolve => { require(['../views/home/module_info.vue'], resolve); },children:[
                { path: 'article_list/:p_type', meta:{title: '平台模块文章列表'}, name: 'module_article_list_tab', 
                component: resolve => { require(['../views/home/module_article_list_tab.vue'], resolve); }},
            ]},
            { path: 'module_article', meta:{title: '平台模块文章'}, name: 'module_article', component: resolve => { require(['../views/home/module_article.vue'], resolve); },children: [
                { path: 'list/:p_type', meta:{title: '平台模块文章列表'}, name: 'module_article_list', component: resolve => { require(['../views/home/module_article_list.vue'], resolve); }},
                { path: 'detail/:id', meta:{title: '平台模块文章详情'}, name: 'module_article_detail', component: resolve => { require(['../views/home/module_article_detail.vue'], resolve); }},    
            ]},
            { path: 'module_find_demand', meta:{title: '平台需求查询'}, name: 'module_find_demand', component: resolve => { require(['../views/home/module_find_demand.vue'], resolve); }},
            { path: 'module_find_service', meta:{title: '平台服务查询'}, name: 'module_find_service', component: resolve => { require(['../views/home/module_find_service.vue'], resolve); }},
        ]
    },
];
// 所有上面定义的路由都要写在下面的routers里
export const routers = [
    ...appRouter,
    ...commonRouters,
];
